package ${package.ServiceImpl};
<#if cfg.enableGetId == 1>
 <#assign keyCount=0>
 <#list table.fields as field>
  <#if field.keyFlag>
   <#assign keyCount=keyCount+1>
  </#if>
 </#list>
</#if>
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
<#if (cfg.enableGetId == 1) && (keyCount gt 1)>
import java.util.HashMap;
</#if>
<#if (cfg.enableGetId == 1) && (keyCount gt 0)>
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.List;
</#if>

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
 <#if cfg.enableGetId == 1>
  <#if keyCount == 1>
   <#list table.fields as field>
    <#if field.keyFlag>
     public List<${field.propertyType}> getIdList(@Param(Constants.WRAPPER) Wrapper wrapper){
         return baseMapper.getIdList(wrapper);
     }
     public ${field.propertyType} getId(@Param(Constants.WRAPPER) Wrapper wrapper){
         List<${field.propertyType}> list = getIdList(wrapper);
         if(list == null || list.size() <= 0){
             return null;
         }else{
             return list.get(0);
         }
     }
    </#if>
   </#list>
  </#if>
  <#if keyCount gt 1>
   public List<HasMap<String,Object>> getIdList(@Param(Constants.WRAPPER) Wrapper wrapper){
       return baseMapper.getIdList(wrapper);
   }
   public HasMap<String,Object> getId(@Param(Constants.WRAPPER) Wrapper wrapper){
       List<HasMap<String,Object>> list = getIdList(wrapper);
       if(list == null || list.size() <= 0){
           return null;
       }else{
           return list.get(0);
       }
   }
  </#if>
 </#if>
}
</#if>
